package com.xc.h05.service.wyl.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.h05.entity.Systemuser;
import com.xc.h05.mapper.SystemuserMapper;
import com.xc.h05.service.wyl.SystemuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemuserServiceImpl implements SystemuserService {
    @Autowired
    private SystemuserMapper systemuserMapper;
    @Override
    public PageInfo<Systemuser> findAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Systemuser> list = systemuserMapper.findAll();
        PageInfo<Systemuser> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insert(Systemuser systemuser) {
        return systemuserMapper.insert(systemuser);
    }

    @Override
    public int update(Systemuser systemuser) {
        return systemuserMapper.updateByPrimaryKeySelective(systemuser);
    }

    @Override
    public int delete(Long id) {
        return systemuserMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Systemuser findById(Long id) {
        return systemuserMapper.selectByPrimaryKey(id);
    }


}
